unit uniRelPrevisaoEntrega;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, QuickRpt, QRCtrls, jpeg, ExtCtrls, DB, ADODB;

type
  TfrmRelPrevisaoEntrega = class(TForm)
    qrpRel: TQuickRep;
    QRBand1: TQRBand;
    QRLabel1: TQRLabel;
    QRLabel2: TQRLabel;
    qrImgCliente: TQRImage;
    qrbDetalhe: TQRBand;
    qrlData: TQRLabel;
    qrlFatura: TQRLabel;
    QRBand3: TQRBand;
    QRBand2: TQRBand;
    QRLabel14: TQRLabel;
    QRSysData2: TQRSysData;
    QRSysData1: TQRSysData;
    qrlUsuario: TQRDBText;
    qrlPedido: TQRLabel;
    QR_Rel: TADOQuery;
    DS_Rel: TDataSource;
    qrlQuantidade: TQRLabel;
    QR_RelCD_PEDIDO: TWideStringField;
    QR_RelDS_FATURA: TWideStringField;
    QR_RelDATA: TDateTimeField;
    QR_RelQUANTIDADE: TIntegerField;
    QRLabel4: TQRLabel;
    QRLabel5: TQRLabel;
    QRLabel6: TQRLabel;
    QRLabel7: TQRLabel;
    procedure qrbDetalheBeforePrint(Sender: TQRCustomBand;
      var PrintBand: Boolean);
    procedure qrpRelBeforePrint(Sender: TCustomQuickRep;
      var PrintReport: Boolean);
  private
    intLinha:integer;
  public
    { Public declarations }
  end;

var
  frmRelPrevisaoEntrega: TfrmRelPrevisaoEntrega;

implementation

{$R *.dfm}

procedure TfrmRelPrevisaoEntrega.qrbDetalheBeforePrint(
  Sender: TQRCustomBand; var PrintBand: Boolean);
  var colCorBanda : TColor;
  intContador:integer;
begin
  if ((intLinha mod 2) = 0) then
        colCorBanda := TColor(RGB(255,255,255))
     else
        colCorBanda := TColor(RGB(230,230,230));

     for intContador := 0 to qrbDetalhe.ControlCount - 1 do
     begin
         if qrbDetalhe.Controls[intContador] is TQRLabel then
            (qrbDetalhe.Controls[intContador] as TQRLabel).Color := colCorBanda;
         if qrbDetalhe.Controls[intContador] is TQRDBText then
            (qrbDetalhe.Controls[intContador] as TQRDBText).Color := colCorBanda;
         if  qrbDetalhe.Controls[intContador] is TQRRichText then
            (qrbDetalhe.Controls[intContador] as TQRRichText).Color := colCorBanda;

         qrbDetalhe.Color := colCorBanda;
     end;

  inc(intLinha);
  qrlPedido.Caption := QR_Rel.fieldbyname('CD_PEDIDO').AsString;
  qrlData.Caption := QR_Rel.fieldbyname('DATA').AsString;
  qrlFatura.Caption := QR_Rel.fieldbyname('DS_FATURA').AsString;
  qrlQuantidade.Caption := QR_Rel.fieldbyname('QUANTIDADE').AsString;
end;

procedure TfrmRelPrevisaoEntrega.qrpRelBeforePrint(Sender: TCustomQuickRep;
  var PrintReport: Boolean);
begin
  intLinha := 1;
end;

end.
